package com.coocaa.ops.api.v1.home;

import com.coocaa.ops.api.common.model.ResponseData;
import com.coocaa.ops.api.common.util.RequestUtil;
import com.coocaa.ops.api.common.util.ResponseUtil;
import com.coocaa.ops.api.v1.home.model.output.HomeContent;
import com.coocaa.ops.api.v1.home.service.IHomeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zen
 * @date 2020-06-18 17:17
 * @description
 */
@Slf4j
@RestController
@RequestMapping("/tvos")
public class HomeController {
    @Autowired
    private IHomeService homeService;


    /**
     *  获取酷开8.0系统的首页方案
     * @param request 请求数据
     * @return 首页方案
     */
    @RequestMapping(value = "/getHomeModules", method = RequestMethod.GET)
    public ResponseData<HomeContent> getHomeTabs(HttpServletRequest request) {
        HomeContent data = homeService.getHomeContent(RequestUtil.getHeader(request));
        return ResponseUtil.renderSuccess("success", data);
    }
}
